]> dgit.raspbian.org Git - gnome-shell.git/commitdiff
ci: Fix identifying commits in MR
authorFlorian Müllner <fmuellner@gnome.org>
Thu, 25 Jul 2019 20:26:19 +0000 (22:26 +0200)
committerFlorian Müllner <fmuellner@gnome.org>
Thu, 25 Jul 2019 20:31:31 +0000 (22:31 +0200)
When a MR uses a private namespace, "origin" refers to that, and its
master branch may be outdated with regard to upstream master.

We are really only interested in checking the line changes from the commits
in the MR, so figure out the correct branch point instead.

https://gitlab.gnome.org/GNOME/gnome-shell/merge_requests/647

.gitlab-ci/run-eslint.sh

index 4732f986fc43257056790388483493b20516aac9..0f745a58de49ce5e6157491304a304210502e33e 100755 (executable)
@@ -67,7 +67,10 @@ create_common() {
 }
 
 if [ "$CI_MERGE_REQUEST_TARGET_BRANCH_NAME" ]; then
-  commit_range=origin/$CI_MERGE_REQUEST_TARGET_BRANCH_NAME...$CI_COMMIT_SHA
+  git fetch $CI_MERGE_REQUEST_PROJECT_URL.git $CI_MERGE_REQUEST_TARGET_BRANCH_NAME
+  branch_point=$(git merge-base HEAD FETCH_HEAD)
+  commit_range=$branch_point...$CI_COMMIT_SHA
+
   list_commit_range_additions $commit_range > $LINE_CHANGES
 
   # Don't bother with running lint when no JS changed